

class Solution(object):

    def removeElement(self, nums, val):
        """
        :type nums: List[int]
        :type val: int
        :rtype: int
        """
        # new = []
        # for i in range(len(nums)):
        #     if nums[i] == val:
        #         continue
        #     else:
        #         new.append(nums[i])
        # nums = new
        # print(nums)

        i = 0
        while i < len(nums):
            if nums[i] == val:
                nums.pop(i)
                i -= 1
            i += 1
        print(nums)


if __name__ == '__main__':
    sol = Solution()
    sol.removeElement([3, 2, 2, 3], 3)